package wl.redis;

import com.aix.demo.gao.SkipList;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import org.apache.thrift.TException;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

public class RedisServiceImpl  implements RedisService.Iface {
    SkipList skipList=new SkipList();

    @Override
    public Message Wlset(Message message) throws TException {
        String str="";
        switch (message.action){
            case "zadd":
                skipList.insert(Integer.parseInt(message.key),message.value);

                break;

            case "del":

                skipList.delete(Integer.parseInt(message.key));
        }

        List<Map<String,String>> arrayList=skipList.RpcReturnAll();

        Gson gson = new Gson();

        str = gson.toJson(arrayList);
        System.out.println(str);

        return  new Message(str,"","");
    }
}
